package com.todo.biz.application.handler.bizData;

import com.todo.common.common.enums.BusinessSceneEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author azhebuxing
 * @date 2024/5/30 10:57
 * @description
 */
@Component
public class BusinessDataFactory {

    @Autowired
    List<AbstractBusinessDataHandle> businessDataHandleList;


    public AbstractBusinessDataHandle getBusinessDataHandle(BusinessSceneEnum businessSceneEnum) {
        if (businessSceneEnum == null) {
            return null;
        }
        for (AbstractBusinessDataHandle businessDataHandle : businessDataHandleList) {
            if (businessDataHandle.getHandleBusinessScene().equals(businessSceneEnum)) {
                return businessDataHandle;
            }
        }
        return null;
    }
}
